//
//  DeleteViewController.m
//  one class
//
//  Created by M on 17/9/22.
//  Copyright © 2017年 1512. All rights reserved.
//

#import "DeleteViewController.h"

@interface DeleteViewController ()
{
    NSUserDefaults *userDefatluts ;
}
@end

@implementation DeleteViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"删除用户";
    userDefatluts = [NSUserDefaults standardUserDefaults];

   self.view.backgroundColor = [UIColor whiteColor];
    
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"号码将会被删除。" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *action = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive  handler:^(UIAlertAction * _Nonnull action) {
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        NSLog(@"%@",self.data);
        [self.data removeObjectAtIndex:_idx];
        [defaults setObject:self.data forKey:@"phoneMans"];
        [self.navigationController popViewControllerAnimated:YES];

    }];
    [alert addAction:action];
    [alert addAction:action2];
    [self presentViewController:alert animated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
